const authService = require('../services/auth.service');

exports.login = async (req, res) => {
    try {
        const { username, password } = req.body;
        const token = await authService.login(username, password);
        res.json({ token });
    } catch (error) {
        res.status(401).json({ message: error.message });
    }
};

exports.protectedRoute = (req, res) => {
    res.json({ message: 'This is a protected route', user: req.user });
};
